Carbon


FSWriteFork

Header: Files.h Carbon status: Supported

Writes data to an open fork.

OSErr FSWriteFork (
    SInt16 forkRefNum, 
    UInt16 positionMode, 
    SInt64 positionOffset, 
    ByteCount requestCount, 
    void *buffer, 
    ByteCount *actualCount
);
forkRefNum

The reference number of the fork to write to.

positionMode

The base location for the start of the write. The caller can hint to the File Manager whether the data being written should or should not be cached. Set the appropriate bits in positionMode. See “Position Mode Constants” for more information.

positionOffset

The offset from base location for the start of the write.

requestCount

The number of bytes to write.

buffer

A pointer to the data to write.

actualCount

On return, a pointer to the number of bytes actually written. this parameter is optional; if you don’t want it, set actualCount to NULL. The actualCount will be equal to requestCount unless there was an error during the write operation.

function result

A result code. If there is not enough space on the volume to write requestCount bytes, then dskFulErr is returned.

DISCUSSION

Data is written starting at the position specified by positionMode and positionOffset. The call will attempt to write requestCount bytes from the buffer pointed at by the buffer parameter.

The fork’s current position is set to point immediately after the last byte written (that is, the initial position plus actualCount).

You can open the fork using the FSOpenFork call.

AVAILABILITY

Supported in Carbon. Available in Mac OS 9, and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)